﻿using System;
using System.Runtime.Serialization;

using OctoOS;

/// <summary>
/// Summary description for ResourceMeta
/// </summary>
[DataContract]
public class Settings
{
	[DataMember(Order = 1)]
	public CommentsEnabled CommentsEnabled { get; private set; }

	[DataMember(Order = 2)]
	public CommentsModeration CommentsModeration { get; private set; }

	[DataMember(Order = 3)]
	public FeedMode FeedMode { get; private set; }

	[DataMember(Order = 4)]
	public int DisableAfter { get; private set; }

	[DataMember(Order = 5)]
	public bool EnableSubTitle { get; private set; }

	[DataMember(Order = 6)]
	public bool SyndicatePosts { get; private set; }

	[DataMember(Order = 7)]
	public bool Bookmarks { get; private set; }

	[DataMember(Order = 8)]
	public bool SendToFriend { get; private set; }

	[DataMember(Order = 9)]
	public bool Print { get; private set; }

	//[DataMember(Order = 10)]
	//public bool TrackbarUrl;

	[DataMember(Order = 10)]
	public bool CommentRss { get; private set; }

	public Settings()
	{
		CommentsEnabled = CommentsEnabled.Anonymous;
		CommentsModeration = CommentsModeration.Always;
		FeedMode = FeedMode.None;
	}

	public Settings(CommentsEnabled commentsEnabled, CommentsModeration commentsModeration,
		FeedMode feedModeSelect, int disableAfter, bool enableSubtitle,
		bool syndicatePosts, bool bookmarks, bool sendToFriend, bool print,
		//bool trackBarUrl, 
		bool commentRss)
	{
		CommentsEnabled = commentsEnabled;
		CommentsModeration = commentsModeration;
		FeedMode = feedModeSelect;
		DisableAfter = disableAfter;
		EnableSubTitle = enableSubtitle;
		SyndicatePosts = syndicatePosts;
		Bookmarks = bookmarks;
		SendToFriend = sendToFriend;
		Print = print;
		//TrackbarUrl = trackBarUrl;
		CommentRss = commentRss;
	}

	public byte[] ToArray()
	{
		return ConvertUtility.ToProtoBuf<Settings>(this);
	}

	public static Settings Create(byte[] data)
	{
		return ConvertUtility.FromProtoBuf<Settings>(data);
	}
}